<section class="container">

  <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %>

  <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>

  <section data-page="address-transactions" id="txs">
    <div class="card">
      <%= render BlockScoutWeb.AddressView, "_tabs.html", address: @address, is_proxy: is_proxy, conn: @conn %>
      <div class="card-body" data-async-listing="<%= @current_path %>">
        <%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost, click to load newer transactions") %>
        <div class="clearfix">
          <h2 class="card-title float-left"><%= gettext "Transactions" %></h2>
          <div class="top-pagination-outer-container float-right">
            <div class="dropdown u-push-sm">
              <button data-test="filter_dropdown" class="btn-dropdown-line dropdown-toggle" type="button"
                id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Filter: <%= format_current_filter(@filter) %>
              </button>
              <div class="dropdown-menu dropdown-menu-right filter" aria-labelledby="dropdownMenu2">
                <%= link(
                  gettext("All"),
                  to: AccessHelper.get_path(@conn, :address_transaction_path, :index, @address.hash),
                  class: "address__link address__link--active dropdown-item",
                  "data-test": "filter_option"
                ) %>
                <%= link(
                  gettext("To"),
                  to: AccessHelper.get_path(@conn, :address_transaction_path, :index, @address.hash, %{:filter => "to"}),
                  class: "address__link address__link--active dropdown-item",
                  "data-test": "filter_option"
                ) %>
                <%= link(
                  gettext("From"),
                  to: AccessHelper.get_path(@conn, :address_transaction_path, :index, @address.hash, %{:filter => "from"}),
                  class: "address__link address__link--active dropdown-item",
                  "data-test": "filter_option"
                ) %>
              </div>
            </div>
            <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
          </div>
        </div>
        <div data-selector="channel-batching-message" style="display: none;">
          <div data-selector="reload-transactions-button" class="alert alert-info">
            <a href="#" class="alert-link"><span data-selector="channel-batching-count"></span> <%= gettext "More transactions have come in" %></a>
          </div>
        </div>
        <button data-error-message class="alert alert-danger col-12 text-left" style="display: none;">
          <span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span>
        </button>

        <div data-empty-response-message style="display: none;">
          <div class="tile tile-muted text-center" data-selector="empty-transactions-list">
            <%= gettext "There are no transactions for this address." %>
          </div>
        </div>

        <div data-items>
          <%= render BlockScoutWeb.CommonComponentsView, "_tile-loader.html" %>
        </div>

        <div class="transaction-bottom-panel">
          <%= render BlockScoutWeb.CommonComponentsView, "_csv_export_button.html", address: Address.checksum(@address.hash), type: "transactions", filter_type: :address, filter_value: @filter, conn: @conn %>
          <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
        </div>

      </div>
    </div>
    <script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address-transactions.js") %>"></script>
  </section>
</section>
